#include "variables.h"
#include "variables_def.h"
#include "functions.h"

int main( int argc, char *argv[] ){

  set_parameters( argc, argv );

  //  if( gnuplot_type == 1 ){
  //    mkdir_for_gnuplot();
  //  }

  initialize_layers();
  initialize_individuals();
  initialize_archives();

  set_init_center_sigma();
  set_beta();

  while( 1 ){

    number_of_generations++;

    population_merge();

    archives_sort();

    update_model();

    offspring();

    // 終了判定

    if( terminate() )
      break;

    if( number_of_generations == 1 || number_of_generations % 250 == 0 ){
       print_best();
       //print_sigma();
      //      print_center();
    }

  }

  //  if( gnuplot_type == 1 )
  //    finalize_for_gnuplot();

  return 0;
}
